import { BaseSys } from "../../BaseSys";
import { ComponentsMgr } from "../Components/ComponentsMgr";
import { DComponents } from "../Components/DComponents";
/**
 * 基础系统
 */
export class DSystem extends BaseSys {
    constructor() {
        super()
    }
    public static ins(): DSystem {
        return super.ins();
    }
    public find(components: DComponents[], tar: Function) {
        for (let component of components) {
            if (component instanceof tar) {
                if (component.enabled) {
                    return component;
                }
            }
        }
        return undefined;
    }
    public update() {
        let entitys = ComponentsMgr.ins().getEntitys()
        for (let eid of entitys) {
            if (this.bEnable(eid)) {
                this.execute(eid);
            }
        }
    }


    public bEnable(eid): boolean {
        return true;
    }
    public execute(eid) {

    }

}
